home *** CD-ROM | disk | FTP | other *** search
- Path: mcmail.CIS.McMaster.CA!not-for-mail
- From: g9326161@mcmail.cis.McMaster.CA (Hong Shen)
- Newsgroups: comp.lang.c++
- Subject: delete or delete [] ?
- Date: 1 Apr 1996 13:36:23 -0500
- Organization: McMaster University, Hamilton, Ontario, Canada.
- Message-ID: <4jp7n7$f8k@mcmail.CIS.McMaster.CA>
- NNTP-Posting-Host: mcmail.cis.mcmaster.ca
-
- In almost all of C++ literatures, "delete aa" should be used iff aa is not an
- array and "delete [] aa" should be used iff aa is an array. In following case,
- what should I use?
-
- typedef int int10[10];
- int* aa=new int10; // array of 10 integers.
-
- delete aa;
-
- or
-
- delete [] aa;
-
- For gcc (v2.6), it seems that both work. Which is the standard one?
-
- Thanks!
-
- Hong Shen
-
-